/**
 * FileName: StudentController
 * Author:   Administrator
 * Date:     2018/7/6 16:56
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.test.controller;

import com.test.domain.Student;
import com.test.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("/student")
public class StudentController {

    @Autowired
    StudentService studentService;

    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public String add() {
        Student student = new Student();
        student.setStudentId("1006435652");
        student.setName("name26652");
        studentService.createUser(student);
        return "success";
    }

    @RequestMapping("/get")
    public List<Student> get() {
        List<Student> students = studentService.getByPage(1, 10);
        System.out.println(students.size());
        return students;
    }
}
